<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        li:nth-child(odd) {
            background: red;
        }

        li:nth-child(even) {
            background: green;
        }
    </style>
</head>
<body>
<ul>
    <!--
         nth-child(odd)
                    odd          选择到奇数行
         nth-child(even)
                    even         选择到偶数行

    -->
    <li>red</li>
    <li>green</li>
    <li>blue</li>
    <li>yellow</li>
    <li>pink</li>
</ul>
</body>
</html>